#include <stdio.h>
#include <stdlib.h>

#include "cgpoly.h"

int main ()
{

      PASetNewPA (0);

      PASetNewPoly (1);

      PASetNewBound ();
      PASetNewPoint (-1, -1);
      PASetNewPoint (0, -1);
      PASetNewPoint (1, 0);
      PASetNewPoint (-1, 0);
      PASetEndBound ();

      PASetNewBound ();
      PASetNewPoint (-0.5, -0.6);
      PASetNewPoint (-0.5, -0.3);
      PASetNewPoint (0, -0.3);
      PASetNewPoint (0, -0.6);
      PASetEndBound ();

      PASetEndPoly();

      PASetNewPoly (1);

      PASetNewBound ();
      PASetNewPoint (0, -3);
      PASetNewPoint (1, -3);
      PASetNewPoint (2, -2);
      PASetNewPoint (1.5, -1.5);
      PASetNewPoint (2, -1);
      PASetNewPoint (1, -1);
      PASetNewPoint (1, -2);
      PASetNewPoint (0, -2);
      PASetEndBound ();

      PASetEndPoly();

      PASetEndPA();

      PASetNewPA (1);

      PASetNewPoly (1);

      PASetNewBound ();
      PASetNewPoint (0.5, -2.5);
      PASetNewPoint (3, -2.5);
      PASetNewPoint (3, 1);
      PASetNewPoint (0.5, 1);
      PASetEndBound ();

      PASetNewBound ();
      PASetNewPoint (1, -1.5);
      PASetNewPoint (1, -0.5);
      PASetNewPoint (1.5, -0.5);
      PASetNewPoint (1.5, -1.5);
      PASetEndBound ();

      PASetNewBound ();
      PASetNewPoint (1.5, -2);
      PASetNewPoint (2, -1.5);
      PASetNewPoint (2, -1);
      PASetNewPoint (1.75, -0.5);
      PASetNewPoint (2.5, -0.5);
      PASetNewPoint (2.5, -2);
      PASetEndBound ();

      PASetEndPoly();

      PASetEndPA ();

      PADiff(0, 1, 2);
      PAInter(0, 1, 3);
      PAUnion(0, 1, 4);

      for (int i = 0; i < 5; ++ i) 
      {
            char tstr[256];
            sprintf (tstr, "pa%d.asy", i);
            PAPrint (tstr, i);
      }

      return EXIT_SUCCESS;
}

